<script type="text/javascript">
    $(function(){
        $("#kcgd_cgd_table").datagrid({
            onLoadSuccess:function(){
                $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
            }
        })

        $("#kcgd_xsd_table").datagrid({
            onLoadSuccess:function(){
                $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
            }
        })

        $("#kcgd_lld_table").datagrid({
            onLoadSuccess:function(){
                $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
            }
        })

        $("#kcgd_kcpd_table").datagrid({
            onLoadSuccess:function(){
                $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
            }
        })

//        kcgdZkdmxGrid($.webPath() + '/kcgl/zksq/kcgdZkdmx?khId=' + $("#kcgd_detail_id").val()||'');
    })

    function kcgdZkdmxGrid(href, cdOptions, fsOptions) {
        $("#kcgd_zkdmx_table").edatagrid({
            url:href,
            fitColumns:false,
            singleSelect:true,
            fit:true,
            checkOnSelect:false,
            selectOnCheck:false,
            showFooter:true,
            rownumbers:true,
            toolbar:"#zkd_zkdmx_toolbar",
            columns:[
                [
                    {field:'wzgg.id', title:'物资ID', hidden:true},
                    {field:'zkd.zkdh', title:'转库单号', width:120,align: 'center'},
                    {field:'wzgg.code', title:'物资编码', width:100,align: 'center'},
                    {field:'wzgg.name', title:'物资名称', width:100,align: 'center'},
                    {field:'wzgg.ggxh', title:'规格型号', width:100,align: 'center'},
                    {field:'wzgg.dw', title:'单位', width:70,align: 'center'},
                    {field:'wzgg.th', title:'图号', width:70,align: 'center'},
                    {field:'kh_id', title:'卡号ID', hidden:true},
                    {field:'kh.khbm', title:'卡号', width:120,align: 'center'},
                    {field:'kh.nkhbm', title:'新卡号', width:120,align: 'center'},
                    {field:'zkjs',title:'开单件数', width:100,align: 'right'},
                    {field:'zksl',title:'开单重量', width:100,align: 'right',
                        formatter:function(value){
                            var val = formatSlForHtml(value);
                            return val;
                        }},
                    {field:'zcjs',title:'转出件数', width:100,align: 'right'},
                    {field:'zcsl',title:'转出重量', width:100,align: 'right',
                        formatter:function(value){
                            var val = formatSlForHtml(value);
                            return val;
                        }},
                    {field:'zrjs',title:'转入件数', width:100,align: 'right'},
                    {field:'zrsl',title:'转入重量', width:100,align: 'right',
                        formatter:function(value){
                            var val = formatSlForHtml(value);
                            return val;
                        }},
                    {field:'bz', editor:{type:'text'}, title:'备注', width:100,align: 'center'}
                ]
            ],
            onLoadSuccess:function(){
                $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
            }
        })
    }
</script>

<div id="kcgd_tabs" detail="true" class="easyui-tabs" data-options="fit:true,border:false">
    <input type="hidden" id="kcgd_detail_id" value="${(kh.id)!}"/>
    <div title="采购单信息">
        <table style="width: 100%" class="tb tab-t t-bor">
            <table id="kcgd_cgd_table" class="easyui-datagrid" url="${base}/kcgl/kcgd/kcgd_cgmx?kh.id=${(kh.id)!}"
                   showFooter="true" rownumbers="true" fitColumns="true" style="width: 1950px">
                <thead>
                <tr>
                    <th data-options="field:'cgd.cgdh',width:50,align: 'center'" rowspan="2">采购单号</th>
                    <th data-options="field:'khbm',width:50,align: 'center'" rowspan="2">卡号</th>
                    <th data-options="field:'wzgg.code',width:40,align: 'center'" rowspan="2">物资编码</th>
                    <th data-options="field:'wzgg.name',width:30,align: 'center'" rowspan="2">物资名称</th>
                    <th data-options="field:'wzgg.ggxh',width:30,align: 'center'" rowspan="2">规格型号</th>
                    <th data-options="field:'wzgg.dw',width:30,align: 'center'" rowspan="2">单位</th>
                    <th data-options="field:'cd.z',width:20,align: 'center'" rowspan="2">产地</th>
                    <th colspan="2">发货</th>
                    <th data-options="field:'jzfs.z',width:25,align: 'center'" rowspan="2">记重方式</th>
                    <th colspan="2">到货</th>
                    <th data-options="field:'hsj',width:45,formatter:formatJeForHtml,align: 'right'" rowspan="2">含税价</th>
                    <th data-options="field:'bhsj',width:45,formatter:formatJeForHtml,align: 'right'" rowspan="2">不含税价</th>
                    <th data-options="field:'bz',width:30,align: 'center'" rowspan="2">备注</th>
                </tr>
                <tr>
                    <th data-options="field:'js',width:45,align: 'right'">件数</th>
                    <th data-options="field:'sbsl',width:45,formatter:formatSlForHtml,align: 'right'">重量</th>
                    <th data-options="field:'rkjs',width:45,align: 'right'">件数</th>
                    <#--<th data-options="field:'rkjz',width:45,align: 'right'">件重</th>-->
                    <th data-options="field:'rksl',width:45,formatter:formatSlForHtml,align: 'right'">重量</th>
                </tr>
                </thead>
            </table>
        </table>
    </div>

    <div title="销售单信息">
        <table id="kcgd_xsd_table" style="width: 100%" class="tb tab-t t-bor">
            <table class="easyui-datagrid" url="${base}/kcgl/kcgd/kcgd_xsmx?kh.id=${(kh.id)!}"
                   showFooter="true" rownumbers="true"  fitColumns="true"style="width: 1950px" >
                <thead>
                <tr>
                    <th data-options="field:'xsd.xsdh',width:50,align: 'center'" rowspan="2">销售单号</th>
                    <th data-options="field:'kh.khbm',width:50,align: 'center'" rowspan="2">卡号</th>
                    <th data-options="field:'wzgg.code',width:40,align: 'center'" rowspan="2">物资编码</th>
                    <th data-options="field:'wzgg.name',width:30,align: 'center'" rowspan="2">物资名称</th>
                    <th data-options="field:'wzgg.ggxh',width:30,align: 'center'" rowspan="2">规格型号</th>
                    <th data-options="field:'wzgg.dw',width:25,align: 'center'" rowspan="2">单位</th>
                    <th data-options="field:'cd.z',width:25,align: 'center'" rowspan="2">产地</th>
                    <th data-options="field:'jzfs.z',width:35,align: 'center'" rowspan="2">记重方式</th>
                    <th colspan="2">开单</th>
                    <th colspan="2">出库</th>
                    <th data-options="field:'bhsj',width:45,formatter:formatJeForHtml,align: 'right'" rowspan="2">不含税价(元)</th>
                    <th data-options="field:'hsj',width:45,formatter:formatJeForHtml,align: 'right'" rowspan="2">含税价(元)</th>
                </tr>
                <tr>
                    <th data-options="field:'js',width:50,align: 'right'" rowspan="2">件数</th>
                    <th data-options="field:'sbsl',width:50,formatter:formatSlForHtml,align: 'right'" rowspan="2">重量</th>
                    <th data-options="field:'ck_js',width:50,align: 'right'" rowspan="2">件数</th>
                    <th data-options="field:'ck_sbsl',width:50,formatter:formatSlForHtml,align: 'right'" rowspan="2">重量</th>
                </tr>
                </thead>
            </table>
        </table>
    </div>

    <div title="内部领料">
       <table  id="kcgd_lld_table" style="width: 100%" class="tb tab-t t-bor">
           <table class="easyui-datagrid" url="${base}/kcgl/kcgd/kcgd_lldmx?kh.id=${(kh.id)!}"
                  showFooter="true" rownumbers="true"  fitColumns="true"style="width: 1950px">
                <thead>
                <tr>
                    <th data-options="field:'wzgg.code',width:50,align: 'center'" rowspan="2">物资编码</th>
                    <th data-options="field:'wzgg.name',width:40,align: 'center'" rowspan="2">物资名称</th>
                    <th data-options="field:'wzgg.ggxh',width:30,align: 'center'" rowspan="2">规格型号</th>
                    <th data-options="field:'wzgg.dw',width:30,align: 'center'" rowspan="2">单位</th>
                    <th data-options="field:'cd.z',width:30,align: 'center'" rowspan="2">产地</th>
                    <th data-options="field:'chd',width:30,align: 'center'" rowspan="2">长度</th>
                    <th data-options="field:'jz',width:30,align: 'center'" rowspan="2">件重</th>
                    <th data-options="field:'jzfs.z',width:35,align: 'center'" rowspan="2">计重方式</th>
                    <th data-options="field:'wsdj',width:55,formatter:formatJeForHtml,align: 'right'" rowspan="2">单价(不含税)</th>
                    <th colspan="3">开单</th>
                    <th colspan="3">发料</th>
                    <th data-options="field:'llbz',width:20,align: 'center'" rowspan="2">备注</th>
                </tr>
                <tr>
                    <th data-options="field:'kdjs',width:20,align: 'right'">件数</th>
                    <th data-options="field:'kdsl',width:50,formatter:formatSlForHtml,align: 'right'">重量</th>
                    <th data-options="field:'kdje',width:50,formatter:formatJeForHtml,align: 'right'">金额(不含税)</th>
                    <th data-options="field:'fljs',width:20,align: 'right'">件数</th>
                    <th data-options="field:'flsl',width:50,formatter:formatSlForHtml,align: 'right'">重量</th>
                    <th data-options="field:'flje',width:50,formatter:formatJeForHtml,align: 'right'">金额(不含税)</th>
                </tr>
                </thead>
            </table>
       </table>
    </div>
    <div title="转库单明细">
        <table id="kcgd_zkdmx_table">
        </table>
    </div>

    <#--<div title="转库单">-->

    <#--</div>-->

    <div title="库存盘点信息">
        <table id="kcgd_kcpd_table" style="width: 100%" class="tb tab-t t-bor">
            <table class="easyui-datagrid" url="${base}/kcgl/kcgd/kcgd_pdmx?kh.id=${(kh.id)!}"
                   showFooter="true" rownumbers="true"  fitColumns="true" style="width: 1700px">
                <thead>
                <tr>
                    <th data-options="field:'kh.khbm',width:85,align: 'center'">卡号</th>
                    <th data-options="field:'wzgg.code',width:75,align: 'center'">物资编码</th>
                    <th data-options="field:'wzgg.name',width:55,align: 'center'">物资名称</th>
                    <th data-options="field:'wzgg.ggxh',width:55,align: 'center'">规格型号</th>
                    <th data-options="field:'cd.z',width:40,align: 'center'">产地</th>
                    <th data-options="field:'wzgg.dw',width:35,align: 'center'">单位</th>
                    <th data-options="field:'kh.wsdj',width:75,formatter:formatJeForHtml,align: 'right'">无税单价(元)</th>
                    <th data-options="field:'kh.sl',width:100,formatter:formatSlForHtml,align: 'right'">账面重量</th>
                    <th data-options="field:'spsl',width:100,formatter:formatSlForHtml,align: 'right'">实盘重量</th>
                    <th data-options="field:'yksl',width:100,formatter:formatSlForHtml,align: 'right'">盈亏重量</th>
                    <th data-options="field:'ykje',width:100,formatter:formatJeForHtml,align: 'right'">盈亏金额(元)</th>
                </tr>
                </thead>
            </table>
        </table>
    </div>
</div>